package com.youku.expression.ast;

public class DecrAst extends UnaryAst {

	public DecrAst(boolean prefix, Ast ast) {
		super(prefix, ast);
		operation="--";
	}

	@Override
	public Object operate(Object element) {

		if (element instanceof Number) {
			if (element instanceof Double) {
				return ((Number) element).doubleValue() - 1;
			} else if (element instanceof Float) {
				return ((Number) element).floatValue() - 1;
			} else if (element instanceof Long) {
				return ((Number) element).longValue() - 1;
			} else {
				return ((Number) element).intValue() - 1;
			}
		}

		throw new RuntimeException("这里应该是个数字");
	
	}
}
